package xy.come.juhenews.Fragment;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;

import com.zhy.autolayout.AutoLinearLayout;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import lnjh.com.xcoordinatortablibrary.utils.SystemView;
import xy.come.juhenews.Activity.CalendarActivity;
import xy.come.juhenews.Activity.CounterActivity;
import xy.come.juhenews.Activity.GirlPhotoActivity;
import xy.come.juhenews.Activity.QrCodeActivity;
import xy.come.juhenews.Activity.WeatherActivity;
import xy.come.juhenews.Base.BaseFragment;
import xy.come.juhenews.R;

/**
 * Created by Xia_焱 on 2018/7/11.
 * e-mail：XiahaotianV@163.com
 */

public class FindFragment extends BaseFragment {


    @BindView(R.id.ll_photo)
    AutoLinearLayout llPhoto;
    @BindView(R.id.ll_x)
    AutoLinearLayout llX;
    @BindView(R.id.ll_weather)
    AutoLinearLayout llWeather;
    @BindView(R.id.ll_calendar)
    AutoLinearLayout llCalendar;
    @BindView(R.id.ll_qr_code)
    AutoLinearLayout llQrCode;
    @BindView(R.id.ll_counter)
    AutoLinearLayout llCounter;
    Unbinder unbinder;

    @Override
    protected int getLayoutResource() {
        return R.layout.fragment_find;
    }

    @Override
    public void initData() {

    }

    @Override
    protected void initView() {
        setNavigationBar(getActivity());
    }

    @Override
    protected void lazyLoad() {

    }

    private void setNavigationBar(FragmentActivity activity) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {

        } else {
            llX.setPadding(0, SystemView.getStatusBarHeight(activity) >> 1, 0, 0);
        }

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            activity.getWindow().setStatusBarColor(ContextCompat.getColor(getActivity(), R.color.main_color));
        } else {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }

    }


    @OnClick({R.id.ll_photo, R.id.ll_weather, R.id.ll_calendar, R.id.ll_qr_code,R.id.ll_counter})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ll_photo:
                Intent GirlPhotoIntent = new Intent(getActivity(), GirlPhotoActivity.class);
                startActivity(GirlPhotoIntent);
                break;
            case R.id.ll_weather:
                Intent WeatherIntent = new Intent(getActivity(),WeatherActivity.class);
                startActivity(WeatherIntent);
                break;
            case R.id.ll_calendar:
                Intent CalendarIntent = new Intent(getActivity(), CalendarActivity.class);
                startActivity(CalendarIntent);
                break;
            case R.id.ll_qr_code:
                Intent QrCodeIntent = new Intent(getActivity(), QrCodeActivity.class);
                startActivity(QrCodeIntent);
                break;
            case R.id.ll_counter:
                Intent CounterIntent = new Intent(getActivity(), CounterActivity.class);
                startActivity(CounterIntent);
                break;
        }
    }

}
